This is all the code from the first scene of the demo game. It is the title and introduction scene.
All the code is here, exactly as it is in the game. This is followed by a breakdown of the code into sections, with explanations of what each section does and why it is written the way it is.
PRINT{See that incredibly handsome guy on the left? That's Ray. He has a few words for you.}
PRINT{RAY: "Actually, I'm not really Ray, I'm just a drawing. And he's not all that good-looking either! Now, you might think I'm a character, but I'm not.}
PRINT{"I'm an Object. When you open the game file with World Builder, you won't see me in the Characters list. You'll see me listed under Objects.}
PRINT{"There's a good reason for this. The programmer has little control over Characters. The computer controls them, and they are better at fighting or running than they are at talking.}
PRINT{"Except for the player Character, you should only use Characters for things that don't do much except fight or run. And even then, Objects are often better."}
PRINT{----------------------------------------(click NEXT to continue)}
LET{E1#=1}
EXIT
IF{E1#=1}THEN
PRINT{RAY: "Objects are easy to control. I can't run away when I'm supposed to be talking to you. And everything I say is what the programmer wants me to say.}
PRINT{"All my actions are in the code for this scene. I'm just a mindless puppet! It's kind of depressing now that I think about it.}
PRINT{"I can't even wipe this stupid grin off my face unless it's in the code. Hurry up and click the button again, will you? I want to get this over with."}
PRINT{----------------------------------------(click NEXT to continue)}
LET{E1#=2}
EXIT
IF{E1#=2}THEN
PRINT{RAY: "Finally! Now I can go back to STORAGE, the place where Objects and Characters are kept when not in use.}
PRINT{"Play the game, and when you finish you can check out all the code for yourself to see how it all works.}
PRINT{"Be sure to read the text file that came with this game, it will explain every line of code.}
PRINT{"I'm outta here, pal!"}
SOUND{SPACE-TUNE.1}
MOVE{RAY.1}TO{STORAGE@}
PRINT{----------------------------------------(click NEXT to continue)}
LET{E1#=3}
EXIT
IF{E1#=3}THEN
MOVE{NEXT.1}TO{THE GRAND FINALE}
SOUND{SPACE-TUNE.1}
MOVE{PLAYER@}TO{CHART ROOM}
LET{E1#=4}
EXIT
END
****************end of code******************************
The code in this scene is extremely simple, since the only thing the player can do here is click the button. The first time the button is clicked, Variable E1# is less than 1, since it has not been set yet. A sound is played, called SPACE-TUNE.1, then the Objects in the scene are moved to STORAGE@ to create the animation effect. Part way through the animation, the sound is played again. Near the end of the animation, another sound called SPACE-TWINKLE.1} is played. This is followed by a sound called SILENCE.1, which is used to pause the action before the next object is moved. The silence is played twice to provide a longer pause. Then the last object is moved to STORAGE@, and the text is displayed in the text window. The variable is then updated, being set to 1, and the since this part of the code closes with EXIT, the action stops and nothing more happens until the next time the player does something.
IF{CLICK$=NEXT.1}OR{TEXT$=NEXT}THEN <-- This statement checks to see if the player has
has clicked on the "next" button, or
entered the word "next".
IF{E1#<1}THEN <--This statement checks variable E1#, which is
used to determine what action should occur
each time the button is clicked on. As each action
is executed, the variable is incremented upward.
SOUND{SPACE-TUNE.1} This action is the title animation sequence.
MOVE{BEGIN.1}TO{STORAGE@} Sounds are played, and the Objects are moved
MOVE{BEGIN.2}TO{STORAGE@} to storage one by one. Each Object is a different
MOVE{BEGIN.3}TO{STORAGE@} drawing. As one Object is moved, and the next one
MOVE{BEGIN.4}TO{STORAGE@} is revealed, it creates a simple animation effect.
SOUND{SPACE-TUNE.1}
MOVE{BEGIN.5}TO{STORAGE@}
MOVE{BEGIN.6}TO{STORAGE@}
MOVE{BEGIN.7}TO{STORAGE@}
MOVE{BEGIN.8}TO{STORAGE@}
SOUND{SPACE-TWINKLE.1} A sound that is just a half-second
SOUND{SILENCE.1} <-- of silence is used to momentarily
SOUND{SILENCE.1} pause the animation.
MOVE{BEGIN.9}TO{STORAGE@}
>>>>>The next section (below) is the text that is printed in the text window. This is followed by the LET statement, that increases the number of the variable to one. Finally, the entire statement closes with EXIT. This means the program will stop right there, and nothing more will happen until the next time the player does something.<<<<
PRINT{See that incredibly handsome guy on the left? That's Ray. He has a few words for you.}
PRINT{RAY: "Actually, I'm not really Ray, I'm just a drawing. And he's not all that good-looking either! Now, you might think I'm a character, but I'm not.}
PRINT{"I'm an Object. When you open the game file with World Builder, you won't see me in the Characters list. You'll see me listed under Objects.}
PRINT{"There's a good reason for this. The programmer has little control over Characters. The computer controls them, and they are better at fighting or running than they are at talking.}
PRINT{"Except for the player Character, you should only use Characters for things that don't do much except fight or run. And even then, Objects are often better."}
PRINT{----------------------------------------(click NEXT to continue)}
LET{E1#=1}
EXIT
>>>>>When the player clicks on the NEXT button again, the variable E1# will be one. So the first statement is skipped. This next statement (below) checks to see if the variable equals one, and tells the program what to do if it does. In this case, more text is printed in the text window, and the variable is set to two. Once again, the statement closes with EXIT.<<<<<
IF{E1#=1}THEN
PRINT{RAY: "Objects are easy to control. I can't run away when I'm supposed to be talking to you. And everything I say is what the programmer wants me to say.}
PRINT{"All my actions are in the code for this scene. I'm just a mindless puppet! It's kind of depressing now that I think about it.}
PRINT{"I can't even wipe this stupid grin off my face unless it's in the code. Hurry up and click the button again, will you? I want to get this over with."}
PRINT{----------------------------------------(click NEXT to continue)}
LET{E1#=2}
EXIT
>>>>>If the player clicks on the NEXT button, and the variable equals two, the previous statements are skipped. The following statement checks to see if the variable is two, then tells the program what to do if it does. First some text is printed in the text window, then a sound is played and the last Object in the scene, RAY.1, is moved to storage. The variable is incremented up to three, and the statement closes with EXIT.<<<<<
IF{E1#=2}THEN
PRINT{RAY: "Finally! Now I can go back to STORAGE, the place where Objects and Characters are kept when not in use.}
PRINT{"Play the game, and when you finish you can check out all the code for yourself to see how it all works.}
PRINT{"Be sure to read the text file that came with this game, it will explain every line of code.}
PRINT{"I'm outta here, pal!"}
SOUND{SPACE-TUNE.1}
MOVE{RAY.1}TO{STORAGE@}
PRINT{----------------------------------------(click NEXT to continue)}
LET{E1#=3}
EXIT
>>>>The last statement checks to see if the variable equals 3 when the NEXT button is clicked, and then tells the program what to do. The NEXT button, an Object titled “NEXT.1”, is moved to the last scene in the game, where it will be needed at the end of the game. Then a sound is played, and the player is moved to the second scene of the game, titled “Chart Room.” If the two scenes were next to each other it might not be necessary to use code to move the player there. But in this case the scenes are not next to each other. Besides, we don’t want the player to be able to leave the title scene until he has read all of the introductory text.<<<<
IF{E1#=3}THEN
MOVE{NEXT.1}TO{THE GRAND FINALE}
SOUND{SPACE-TUNE.1}
MOVE{PLAYER@}TO{CHART ROOM}
EXIT
END
>>>Notice how each time the player clicks the button (called NEXT.1} or enters the word "next," there is a series of IF/THEN statements that check to see what number is contained in variable E1#. If E1# is less than one, then the first statement is executed. If it equals one, then the second statement is executed, and so on.<<<
Just in case the player tries to attack, the statement below tests for entry of any “attack” verbs, and prints a response: